package com.far.game.xiuzhen.service.impl;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.far.game.xiuzhen.common.database.entity.User;
import com.far.game.xiuzhen.common.database.entity.UserPartner;
import com.far.game.xiuzhen.mapper.UserMapper;
import com.far.game.xiuzhen.service.IUserService;
import com.far.tools.net.http.ReqParamWrapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author mike
 * @Date 2022-07-15 22:26:45
 */
@Service("userServiceImpl")
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public List<Integer> getUserData(User user) {

        List<User> userList = new ArrayList<>();

        if (user.getType().equals(0)) {
            userList = this.lambdaQuery().in(User::getType, 0, 1, 2).list();

        } else if (user.getType().equals(1)) {
            userList = this.lambdaQuery().in(User::getType, 2).list();
            userList.add(user);
        } else if (user.getType().equals(2)) {
            userList.add(user);
        }
        List<Integer> list = userList.stream().map(User::getTid).distinct().collect(Collectors.toList());

        return list;
    }


}
